<?php
/**
 * @copyright Copyright (c) 2021 勾股工作室
 * @license https://opensource.org/licenses/GPL-3.0
 * @link https://www.gougucms.com
 */

namespace app\rszs\model;

use think\facade\Db;
use think\Model;

class RszsLog extends Model
{

	
	//列表检索
    public function get_list($param = [], $where = [], $whereOr=[])
    {

        $rows = empty($param['limit']) ? get_config('app.page_size') : $param['limit'];
        $list = self::where($where)
            ->where(function ($query) use($whereOr) {
					$query->whereOr($whereOr);
			})
			->field('a.*')
			->alias('a')
            ->order('a.create_time desc')
			->paginate($rows, false, ['query' => $param])
			->each(function ($item, $key) {
                $item->admin_name = Db::name('Admin')->where(['id' => $item->admin_id])->value('name');
                $names = Db::name('rszs_log_detail')->where('rszs_log_id', $item->id)->where('delete_time', 0)->column('name');
                $item->users = implode('、', $names);

			});
        return $list;
    }
	

}
